<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>js数组</title>
	<script type="text/javascript">


	var arr = ['北京',[['体育中心','天河城','电脑城'],'番禺','白云'],'东莞','珠海','佛山'];


	// alert(arr[2]);

	// var arr = [];


	// // var arr = new Array('北京','广州','东莞','珠海','佛山');

	// arr[0]='上海';
	// arr[10]='广州';


	// alert(arr[11]);


	// for (var i = 0; i < arr.length; i++) {
	// 	if(arr[i]!='东莞'){
	// 		document.write(arr[i]);
	// 	}
	// };


	// for (var i in arr) {
	// 	document.write(arr[i]);
	// };

	var arr = [1,56,23,6,43,87,3,5,55];

	var arr = [1,56,[23,6,43,87],6,[23,6,43,87,67],87,3,5,55];

	function max (arr) {
		var n = arr[0];
		for (var i in arr) {
			if(arr[i]>n){
				n=arr[i];
			}
		};
		return n;
	}


	var res = max(arr);

	// alert(res);



	var arr = [1,56,[23,6,43,87],6,[23,6,43,87,67],87,3,5,55];


	function long (arr) {
		var m = 0;
		var n = 0;
		for (var i = 0; i < arr.length; i++) {
			if(typeof(arr[i])=='object'){
				if(arr[i].length>m){
					m=arr[i].length;
					n=i;
				}
			}
		};

		return [n,m];
	}

	var res = long(arr);
	alert(arr[res[0]]);













	</script>
</head>
<body>
	
</body>
</html>